package com.hui10.mediaplayer.widget

import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
import android.view.View
import com.hui10.mediaplayer.R
import com.hui10.mediaplayer.model.HomeItemBean
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.item_home.view.*

/**
 * Author: Created by lucus on 2019/5/24.
 * E-mail: mcphilex1989@gmail.com
 * Tel: 15652608401
 */
class HomeItemView : RelativeLayout {


    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

    init {
        View.inflate(context, R.layout.item_home, this)
    }

    fun setData(homeItemBean: HomeItemBean) {
        // 标题
        title.text = homeItemBean.title
        // 内容
        content.text = homeItemBean.description
        // 背景图
        Picasso.get().load(homeItemBean.posterPic).into(bg)
    }
}